<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
      layout:decorate="~{admin/layout}">
<body>

<div class="content-wrap" layout:fragment="content">
    <main id="content" class="content" role="main">
        <ol class="breadcrumb">
            <li>财务管理</li>
            <li class="active">批次管理</li>
        </ol>
        <div class="row mb-lg">
            <div class="tab-content mb-lg" id="myTabContent">
              <!--  <button  style="color: #64bd63;"  data-toggle="modal" data-target="#myModal18"
                    onclick="setid(null)">
                    死亡总比率
                </button>-->
                <div role="tabpanel" class="tab-pane active in clearfix" id="basic" aria-labelledby="basic-tab" aria-expanded="true">
                    <div class="widget-body">
                        <div class="mt">
                            <table class="table table-striped table-hover">
                                <thead>
                                <tr>
                                    <th>批次编号</th>
                                    <th>采购地</th>
                                    <th>数量</th>
                                    <th>当前死亡率</th>
                                    <th>设定死亡率</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="batch:${batchlist1}">
                                    <td th:text="${batch.batchNumber}"></td>
                                    <td th:text="${batch.location}"></td>
                                    <td th:text="${batch.number}"></td>
                                    <td>
                                        <div th:if="${(batch.dienumber/batch.number)>0}">
                                            <span th:text="${(batch.dienumber/batch.number)*100+'%'}"></span>
                                        </div>
                                        <div th:if="${(batch.dienumber/batch.number)<=0}">
                                            <span>暂无死亡</span>
                                        </div>
                                    </td>
                                    <td>
                                        <span th:text="${batch.deathrate+'%'}"></span>
                                        <i class="glyphicon glyphicon-pencil" id="bthd" style="color: #64bd63;"  data-toggle="modal" data-target="#myModal18"
                                           th:id="${batch.batch_id}" onclick="setid(this.id)">
                                        </i>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            <script>
                                function setid(id) {
                                    $("#batch").val(id);
                                }
                            </script>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="myModal18" tabindex="-1" role="dialog" aria-labelledby="myModalLabel18" aria-hidden="true" style="display: none;">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                            <h5 class="modal-title text-xl-center fw-bold mt" id="myModalLabel18">死亡率设定</h5>
                        </div>
                        <div class="modal-body bg-gray-lighter">
                            <form th:action="@{/admin/batch/setting}" enctype="multipart/form-data" id="validation-form" class="form-horizontal form-label-left" method="post">
                                <input type="hidden" name="batch_id" id="batch" >
                                <fieldset>
                                    <div class="form-group row">
                                        <label class="control-label col-sm-3" >
                                            死亡百分比：
                                        </label>
                                        <div class="col-sm-9">
                                            <input type="text" id="chestBreadth" name="deathrate" class="form-control" required="required">
                                        </div>
                                        <div class="col-sm-9">
                                            <button type="submit" id="sub" class="btn btn-danger btn-rounded">提交</button>
                                        </div>
                                    </div>
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>
</div>
</body>
</html>